﻿using System;

using Identity.Dto;

namespace Coder.Workflow.ViewModel
{
    public class WorkTaskViewData
    {
        public WorkTaskViewData(WorkTask task)
        {
            if (task == null) throw new ArgumentNullException(nameof(task));
            Id = task.Id;
            Name = task.Name;
            if (task.Role != null) Role = new RoleDto(task.Role);

            CanEdit = task.CanEdit;
            CanReject = task.CanReject;
            Ordered = task.Ordered;
            CanGiveup = task.CanGiveUp;
            DefaultResolveComment = task.DefaultResolveComment;
        }

        public int Id { get; set; }
        public string Name { get; set; }
        public RoleDto Role { get; set; }

        public bool CanGiveup { get; set; }
        public bool CanEdit { get; set; }

        public bool CanReject { get; set; } = true;
        public string DefaultResolveComment { get; set; }
        /// <summary>
        ///     排序用的。
        /// </summary>
        public int Ordered { get; set; }
    }
}